
public abstract class SYTEventHandler implements Runnable{
	private SYTEventHandler nextSYTEventHandler;
	
	public abstract void preHandler();
	
	public abstract void doHandler();
	
	public abstract void afterHandler();
	
	public void process(){
		preHandler();
		doHandler();
		afterHandler();
	}
	
	public SYTEventHandler getNext() {
		return nextSYTEventHandler;
	}
	public void setNext(SYTEventHandler nextSYTEventHandler) {
		if(this.nextSYTEventHandler != null){
			this.nextSYTEventHandler.setNext(nextSYTEventHandler);
			
		}else{
			this.nextSYTEventHandler = nextSYTEventHandler;
		}
	}
	
	public void run(){
		process();
		SYTEventHandler next = nextSYTEventHandler;
		while(next !=null){
			next.process();
			next = next.getNext();
		}
	}

}
